import * as types from '../Commom/ActionConst';
const initialState = {
    Destination: [],
};

let DestinationReducer = (state = initialState, action) => {
    switch (action.type) {
        case types.kDestination:
            return {
                ...state,
                ...action
            };
        case types.kDestinationReceived:
            if (action.result != null) {
                return Object.assign({}, state, {
                    Destination: action.result,
                });
            } else {
                return Object.assign({}, state, {
                    Destination: [],
                });
            }
        case types.kSearchDestinationMap:
            return {
                ...state,
                ...action
            };
        case types.kSearchDestinationMapReceived:
            if (action.result != null) {
                return Object.assign({}, state, {
                    Destination: action.result,
                });
            } else {
                return Object.assign({}, state, {
                    Destination: [],
                });
            }
        case types.kSearchDestinationlist:
            return {
                ...state,
                ...action
            };
        case types.kSearchDestinationlistReceived:
            if (action.result != null) {
                return Object.assign({}, state, {
                    Destination: action.result,
                });
            } else {
                return Object.assign({}, state, {
                    Destination: [],
                });
            }
        default:
            return state;
    }
};

export default DestinationReducer;